package myEddy.tuple;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

public class TupleTest {

	private Tuple T;
	
	@Before
	public void setUp() throws Exception {
		T = new Tuple("tableA");
		T.addElement("nom", "Leo");
		T.addElement("id", "1");
		T.addElement("1", "lol");
	}

	@Test
	public void testAdditionSuccess() throws Exception {
		assertEquals( T.getColumnNumber(), 3 );
	}
	
	@Test
	public void testRemove() throws Exception
	{ 
		T.removeElement("2");
		assertEquals( T.getColumnNumber(), 3 );
		T.removeElement("1");
		assertEquals( T.getColumnNumber(), 2 );
	}
	
	@Test
	public void testRead() throws Exception
	{
		assertEquals(T.getElement("id"), "1");
		assertEquals(T.getElement("troll"), null);
	}

}
